package com.witmore.neutron.ai.web.apiv2.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.common.response.ResponsePageResult;
import com.witmore.neutron.ai.db.entity.AgentSessionRecordDO;
import com.witmore.neutron.ai.db.entity.AgentSessionRecordDetailDO;
import com.witmore.neutron.ai.web.annotation.RequiresPermission;
import com.witmore.neutron.ai.web.controller.vo.ChatRecordQuery;
import com.witmore.neutron.ai.web.service.SessionRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * V2 对话记录相关接口
 * Author: 豆子高
 * Date: 2025/6/9 10:02
 */
@RestController
@RequestMapping("/v2/session/record/")
public class ChatSessionRecordControllerV2 {

    @Autowired
    private SessionRecordService sessionRecordService;

    /**
     * 获取对话记录列表
     */
    @RequiresPermission("session:list")
    @GetMapping("list")
    public ResponsePageResult<AgentSessionRecordDO> list(ChatRecordQuery query) {
        Page<AgentSessionRecordDO> recordListPage = sessionRecordService.getRecordListPage(query);
        return ResponsePageResult.success(recordListPage);
    }

    /**
     * 获取对话记录详情列表
     */
    @RequiresPermission("session:detail")
    @GetMapping("detail")
    public ResponsePageResult<AgentSessionRecordDetailDO> detail(ChatRecordQuery query) {
        Page<AgentSessionRecordDetailDO> sessionRecordDetailDOPage = sessionRecordService.getRecordDetailListPage(query);
        return ResponsePageResult.success(sessionRecordDetailDOPage);
    }

}
